﻿@using Stamp_For_Africa_Version_2.Models
@using MvcPaging
@model PageOfList<Stamp>
  
<script type="text/javascript">
  function selectStamp(stampId) {
    alert(stampId);
    $('#SelectedChildId').val(stampId);
  return true;
}

</script>       

<br />
<div align="center">

<table>
    <tr>
    <th></th>
		<th>
		</th>
        <th>
            Name
        </th>
        <th>
            Country
        </th>
        <th>
            Face Value
        </th>

        <th>
            Category
        </th>
        <th>
            Sub-Category
        </th>
        <th></th>
    </tr>

@foreach (var item in Model)
{
    <tr>
    <td>
    @{
      var onclickevent = "return selectStamp('" + item.Id + "');";
      @Html.CheckBoxFor(m => item.IsSelected, new { onClick = onclickevent })
    }
    </td>
		<td>
			<img alt ="" src='@Url.Action("ShowStamp", "Stamps", new { item.Id })' width="100", height=auto/>
       
		</td>
        <td>
            @Html.DisplayFor(modelItem => item.DisplayName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Country.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.FaceValue)
        </td>
      
        <td>
            @Html.DisplayFor(modelItem => item.Category.DisplayName )
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.SubCategory )
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
            @Html.ActionLink("Details", "Details", new { id=item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.Id })
        </td>
    </tr>
}

</table>

</div>
<div align="center">
	@foreach (PagerItem item in Html.PagerList(ViewData.Model))
 {
	 if (item.IsSelected)
	 {
		<a href='@item.Url' class="selectedPageNumber" >@item.Text</a>
	 }
	 else
	 {
		<a href='@item.Url' class="pageNumbers">@item.Text</a>  
	 }

 }
</div>
